﻿//********************************************************************************//
//创建日期：<创建日期，2016-03-21>
//创建作者：<郭登杰，guodengjie@shanghai3h.com>
//功能说明：特殊用户录入_与实际用户对照 
//********************************************************************************//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entity;
using BLL;
using BLL.Access;
using System.Data;
using Platform.Http;
using Web.Class;

namespace Web.Pages.YongShui
{
    public partial class YuBianZJH_CompareToFact : BasePage
    {
        #region 属性

        /// <summary>
        /// 接收URL参数水量年
        /// </summary>
        private string i_y;

        /// <summary>
        /// 接收URL参数特殊用户类型
        /// </summary>
        private string i_bz;

        /// <summary>
        /// 记录查询结果集
        /// </summary>
        private DataTable dtSource
        {
            get
            {
                return ViewState["dtSource"] as DataTable;
            }
            set
            {
                ViewState["dtSource"] = value;
            }
        }

        /// <summary>
        /// 记录列表二查询结果集
        /// </summary>
        private DataTable dtSource2
        {
            get
            {
                return ViewState["dtSource2"] as DataTable;
            }
            set
            {
                ViewState["dtSource2"] = value;
            }
        }

        #endregion

        #region 变量

        /// <summary>
        /// 数据访问操作类
        /// </summary>
        SpHelper _spHelper = new SpHelper();

        #endregion

        #region 事件

        /// <summary>
        /// 页面加载事件
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            this.i_y = this.Request.QueryString["i_y"];
            this.i_bz = HttpUtility.UrlDecode(this.Request.QueryString["i_bz"]);
            if(i_bz.Contains("福利"))
            {
                i_bz = "1";
            }
            else if (i_bz.Contains("部队"))
            {
                i_bz = "2";
            }
            else
            {
                i_bz = "3";
            }
            //第一次页面加载
            if (!IsPostBack)
            {
                LoadData();
            }            
            this.gvList1.DataSource = this.dtSource;
            this.gvList1.DataBind();
            this.gvList2.DataSource = this.dtSource2;
            this.gvList2.DataBind();
        }

        #endregion

        #region 方法

        /// <summary>
        /// 查询数据
        /// </summary>
        private void LoadData()
        {
            //加载需删除
            this.dtSource = _spHelper.P_YSJH_TSYHCOMPARETOFACT(int.Parse(this.i_y), int.Parse(this.i_bz), 1).Tables[0];
            this.gvList1.DataSource = this.dtSource;
            this.gvList1.DataBind();
            //加载需加入
            this.dtSource2 = _spHelper.P_YSJH_TSYHCOMPARETOFACT(int.Parse(this.i_y), int.Parse(this.i_bz), 2).Tables[0];
            this.gvList2.DataSource = this.dtSource2;
            this.gvList2.DataBind();
        }

        #endregion
    }
}